#pragma once

#ifndef _Game_h_
#define _Game_h_

#include <d3dx9.h>
#include <string>

#include "Camera.h"
#include "GameComponentCollection.h"
#include "SoundDevice.h"
#include "../d3d/d3dUtility.h"

namespace Framework {

class ContentManager;

class GameComponentCollection;

class Game {
public:
    Game(void);
    virtual ~Game(void);
    Camera* GetCamera();
    void SetCamera(Camera* val);
    GameComponentCollection* GetComponents();
    ContentManager* GetContentManager() const;
    string GetWorkingDirectory();
    string GetExePath();
    FLOAT GetGameTime() const;
    IDirect3DDevice9* GetGraphicsDevice();
    SoundDevice* GetSoundDevice()const;
    void BeginDraw();
    virtual void Draw(FLOAT timeDelta);
    void EndDraw();
    void Run(IDirect3DDevice9* graphicsDevice);
    virtual void Update(FLOAT timeDelta);
protected:
    virtual void Finalize();
    virtual void Initialize();
    virtual void LoadContent();
    virtual void UnloadContent();
private:
    Camera* camera;
    GameComponentCollection* components;
    ContentManager* contentManager;
    FLOAT gameTime;
    IDirect3DDevice9* graphicsDevice;
    bool isDrawing;
    SoundDevice* soundDevice;
    IDirect3DVertexDeclaration9* vertexDecleration;
};

}

#endif